function [w_expect, p_expect] = Postion_S_Curve(stop_time, step_time, Beta)
%w_expect, p_expect为期望的角速度和位置
%stop_time为停止时间 step_time为仿真步长
%Beta为设定加速度
%实现生成位置s曲线
w_expect = zeros(stop_time/step_time,1);    %初始化
p_expect = zeros(stop_time/step_time,1);
len = length(w_expect);
i = 1;
while(i < len/4)
    w_expect(i+1) = w_expect(i) + Beta*step_time;
    p_expect(i+1) = p_expect(i) + w_expect(i)*step_time;
    i = i+1;
end

while(i < len/2)
    w_expect(i+1) = Beta*stop_time/4;
    p_expect(i+1) = p_expect(i) + w_expect(i)*step_time;
    i = i+1;
end

while(i < 3/4*len)
    w_expect(i+1) = w_expect(i) - Beta*step_time;
    p_expect(i+1) = p_expect(i) + w_expect(i)*step_time;
    i = i+1;
end

while(i <= len)
    w_expect(i+1) = 0;
    p_expect(i+1) = p_expect(i) + w_expect(i)*step_time;
    i = i+1;
end
